<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<style>
    .apper{
        display: none;
    }
    .box1{
        width: 300px;
        height: 300px;
        background-color: blueviolet;
        display: block;
    }
</style>
<body>
    <div id="box">
        <div style="display: flex;justify-content: flex-start;">
            <button @click="a=0">按钮1</button>
            <button @click="a=1">按钮2</button>
            <button @click="a=2">按钮3</button>
            <button @click="a=3">按钮4</button>
        </div>
       <div :class="{'box1':a===0,'apper':a!=0}">内容1</div>
       <div :class="{'box1':a===1,'apper':a!=1}">内容2</div>
       <div :class="{'box1':a===2,'apper':a!=2}">内容3</div>
       <div :class="{'box1':a===3,'apper':a!=3}">内容4</div>
        
    </div>
    
</body>
<script src="./Vue.js"></script>
<script>
    // 4. 选项卡 [参考效果](https://www.jq22.com/yanshi24114)
    const {createApp,ref} = Vue;
createApp({

    setup(){
        let a = ref(0);
        return{
            a
    }
    }
}).mount('#box')

</script>
</html>